module.exports = function ($scope, $resource, toaster) {
  var qrcode = '';
  var url = '';
  console.log(window.location.host);
  if (window.location.host == 'tsv.juyouhx.com'){
    url = 'https://weixint.juyouhx.com/views/distributor/apply_distributor.html?cid='
  } else {
    url = 'https://dlqt.juyouhx.com/skv4/views/distributor/apply_distributor.html?cid='
  }
  var cid = '';
  var pwx = 0;
  $resource('/api/ac/mc/merchantUserShopService/getcid', {}, {}).save({}, function (res) {
    if (res.errcode === 0) {
      console.log(res.data);
      cid = res.data.cid;
      qrcode = url + cid + '&' + 'pwx=0';
      console.log('qrcode:' + qrcode);
      function timing() {
        $('#qrcode').qrcode({ 
            width: 250, 
            height: 250,
            text: qrcode
        });
      }
      timing();
    } else {
      toaster.error({ title: '', body: res.errmsg });
    }
  });
  


}  